/**
 * 
 */
package com.bolbachchan.blog.service.posts;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.bolbachchan.blog.dao.posts.UserPostsDAO;
import com.bolbachchan.blog.dto.NewPostDTO;
import com.bolbachchan.blog.dto.PostDTO;
import com.bolbachchan.blog.hibernate.domain.Posts;

/**
 * @author Chaitanya
 * 
 */
public class UserPostsServiceImpl implements UserPostsService {

    @Autowired
    private UserPostsDAO userPostsDao;

    /*
     * (non-Javadoc)
     * @see
     * com.bolbachchan.blog.service.posts.PostsService#saveNewPost(com.bolbachchan
     * .blog.dto.NewPostDTO)
     */
    @Override
    public void saveNewPost(NewPostDTO dto) {
	userPostsDao.saveNewPost(dto);
    }

    /*
     * (non-Javadoc)
     * @see
     * com.bolbachchan.blog.service.posts.PostsService#updatePost(com.bolbachchan
     * .blog.dto.PostDTO)
     */
    @Override
    public void updatePost(PostDTO dto) {
	userPostsDao.updatePost(dto);
    }

    /*
     * (non-Javadoc)
     * @see
     * com.bolbachchan.blog.service.posts.PostsService#getPostsByUserId(com.
     * bolbachchan.blog.dto.PostDTO)
     */
    @Override
    public List<Posts> getPostsByUserId(PostDTO dto) {
	return userPostsDao.getPostsByUserId(dto);
    }

    /*
     * (non-Javadoc)
     * @see
     * com.bolbachchan.blog.service.posts.UserPostsService#getPostsByPostId(int)
     */
    @Override
    public Posts getPostsByPostId(int objId) {
	return userPostsDao.getPostByPostId(objId);
    }

    /*
     * (non-Javadoc)
     * @see com.bolbachchan.blog.service.posts.UserPostsService#saveNewPost(com.
     * bolbachchan.blog.hibernate.domain.Posts)
     */
    @Override
    public void saveNewPost(Posts post) {
	userPostsDao.saveNewPost(post);
    }

    /*
     * (non-Javadoc)
     * @see com.bolbachchan.blog.service.posts.UserPostsService#updatePost(com.
     * bolbachchan.blog.hibernate.domain.Posts)
     */
    @Override
    public void updatePost(Posts post) {
	userPostsDao.updatePost(post);
    }

    /*
     * (non-Javadoc)
     * @see
     * com.bolbachchan.blog.service.posts.UserPostsService#getPostsByUserId(int)
     */
    @Override
    public List<Posts> getPostsByUserId(int userId) {
	return userPostsDao.getPostsByUserId(userId);
    }

}
